package com.twu.biblioteca;

import java.util.*;

class UserRepository {

    private final Map<String, User> users = new HashMap<>();

    void add(User user) {
        users.put(user.getUsername(), user);

    }

    Collection<User> findAll() {
        return users.values();
    }

    User findByUsername(String username) {
        if (users.containsKey(username)) {
            return users.get(username);
        }
        return null;
    }

}
